#include "testlib.h"
#include <stdio.h>
#include <string>
#include <algorithm>
using namespace std;
#define R 510
#define N 1000010
int h[R][R], x[N], y[N], r[N];
bool in(int x1, int y1, int r1, int x2, int y2, int r2)
{
	int x, y11, y12, y21, y22;
	if(r2>r1) return 0;
	if((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)<=(r1-r2)*(r1-r2)) return 1;
	if((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)>(r1-r2+3)*(r1-r2+3)) return 0;
	if((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)>(r1+r2)*(r1+r2)) return 0;
	for(x=max(x1-r1, x2-r2); x<=min(x1+r1, x2+r2); x++)
	{
		y11=y1-h[r1][abs(x-x1)];
		y12=y1+h[r1][abs(x-x1)];
		y21=y2-h[r2][abs(x-x2)];
		y22=y2+h[r2][abs(x-x2)];
		if(y21<y11 || y22>y12) return 0;
	}
	return 1;
}
bool sec(int x1, int y1, int r1, int x2, int y2, int r2)
{
	int x, y11, y12, y21, y22;
	for(x=max(x1-r1, x2-r2); x<=min(x1+r1, x2+r2); x++)
	{
		y11=y1-h[r1][abs(x-x1)];
		y12=y1+h[r1][abs(x-x1)];
		y21=y2-h[r2][abs(x-x2)];
		y22=y2+h[r2][abs(x-x2)];
		if(y11<=y22 && y21<=y12) return 1;
	}
	return 0;
}
int main(int argc, char * argv[])
{
	registerTestlibCmd(argc, argv);
	int i, j, k, n, f;
	string s;
	s=ouf.readWord();
	if(s=="Ok")
	{
		s=ans.readWord();
		if(s=="Ok") quitf(_ok, "answer is ok");
		else quitf(_wa, "expected failed pair, found ok");
	}
	else
	{
		for(i=0; i<R; i++)
			for(k=i, j=0; j<=i; h[i][j]=k, j++)
				for(; k*k+j*j>i*i; k--);	
		sscanf(s.c_str(), "%d", &i); i--;
		j=ouf.readInt(); j--;
		if(j<i) swap(i, j);
		n=inf.readInt();
		if(i<0 || i==j || j>=n) quitf(_pe, "invalid circle number");
		for(k=0; k<n; x[k]=inf.readInt(), y[k]=inf.readInt(), r[k]=inf.readInt(), k++);
		if(!sec(x[i], y[i], r[i], x[j], y[j], r[j])) quitf(_wa, "circles do not intersect each other");
		if(!in(x[i], y[i], r[i], x[j], y[j], r[j])) f=1;
		else
			for(f=0, k=i+1; k<j; k++)
				if(x[k]!=x[k-1] || y[k]!=y[k-1] || r[k]!=r[k-1])
					if(!in(x[i], y[i], r[i], x[k], y[k], r[k])) { f=1; break; }
		if(!f) quitf(_wa, "the %d-th circle is inside of the %d-th and all between them", j+1, i+1);
		s=ans.readWord();
		if(s=="Ok") quitf(_fail, "there is an invalid pair of circles");
		else quitf(_ok, "%d-th and %d-th are invalid", i+1, j+1);
	}
}